package com.oocl.command;

import com.oocl.dataprocess.filter.Impl.FilterRex;
import com.oocl.dataprocess.parser.Impl.ParseTxT;

public class ParseCommand {
	private Command c = new Command(new FilterRex(), new ParseTxT());
	public String parseCommand(String command){
		String[] commands = command.split(" ");
		if(commands.length ==3){
			if(commands[0].equalsIgnoreCase("L"))
				return parseL(commands[1]);
			else if(commands[0].equalsIgnoreCase("C")){
				c.createXMLFile();
				return "";
			}
			
			return "please check your fomat!";
		}else{
			return "please check your fomat!";
		}
	}
	private String parseL(String l){
		if("xml".endsWith(l)){
			return c.getXMLById();
		}else if("line".endsWith(l)){
			return c.getStringOrderByBirth();
		}else{
			return "incorrect command";
		}
	}
	
	
}
